/**
 *  *2010-6-27 上午03:10:05  add 
 */
package com.base.myproject.client.ui.dialog;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.Image;

/**
 * @author Administrator
 *2010-6-27
 * javazgw@gmail.com
 */
public class ShowHtmlDialog {
	static ShowHtmlDialog showdialog = null;
	  final DialogBox dialogBox = new DialogBox();
	  HTML details = new HTML("");
	  Image image = new Image("");
	private ShowHtmlDialog()
	{
		 dialogBox.setGlassEnabled(true);
		    dialogBox.setAnimationEnabled(true);
		    dialogBox.ensureDebugId("htmlDialogBox");
		    dialogBox.setText("查看");
		   
		    // Create a table to layout the content
		    com.google.gwt.user.client.ui.VerticalPanel dialogContents = new com.google.gwt.user.client.ui.VerticalPanel();
		    dialogContents.setSpacing(4);
		    dialogBox.setWidget(dialogContents);

		    // Add some text to the top of the dialog
		  
		    dialogContents.add(details);
		    dialogContents.setCellHorizontalAlignment(details,
		        HasHorizontalAlignment.ALIGN_CENTER);

		  
		    // Add a close button at the bottom of the dialog
		    com.google.gwt.user.client.ui.Button closeButton = new com.google.gwt.user.client.ui.Button ("关闭",
		        new ClickHandler() {
		          public void onClick(ClickEvent event) {
		            dialogBox.hide();
		          }
		        });
		    dialogContents.add(closeButton);
		    if (LocaleInfo.getCurrentLocale().isRTL()) {
		      dialogContents.setCellHorizontalAlignment(closeButton,
		          HasHorizontalAlignment.ALIGN_LEFT);

		    } else {
		      dialogContents.setCellHorizontalAlignment(closeButton,
		          HasHorizontalAlignment.ALIGN_RIGHT);
		    }
		    
	}
	static public ShowHtmlDialog getInstance()
	{
		if(showdialog==null)
		{
			showdialog = new ShowHtmlDialog();
		}
		return showdialog;
	}
	public void show(String htmltitle,String imagepath)
	{
		details.setHTML(htmltitle);
		
		 dialogBox.center();
		dialogBox.show();
	}
	
	 
}
